package cn.learn.async.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.util.concurrent.Future;

/**
 * @author huangyezhan
 * @version 1.0
 * @date 2020年12月25日21:40
 */
@Component
public class AsyncService2 {

    @Async
    public Future<String> testAsync1(String value) {

        try {
            System.out.println(value);
            Thread.sleep(5 * 1000);
            System.out.println("执行完毕：" + value);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return  new AsyncResult<>(value + "卡住完毕");
    }



}
